#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main()
{
    int connfd;

    int sockfd =init(6666,"0.0.0.0");
    if (sockfd == -1)
	{
		printf("init is defualt\n");
		return -1;
	}
F:
    connfd = accept(sockfd,NULL,NULL);
    if (connfd == -1)
	{
		perror("accept");
		return -1;
	}
	printf("连接成功\n");

    while (1)
    {
        char buf_name[100];
        char buf_passwd[100];
        char buf[100];
        
        if(read(connfd,buf_name,sizeof(buf_name)) && read(connfd,buf_passwd,sizeof(buf_passwd)) == 0)
        {
            printf("数据为空");
            close(connfd);
            goto F;
        }
        printf("name=%s,passwd=%s",buf_name,buf_passwd);

        write(connfd,buf,sizeof(buf));
    }
    
}